import request from '@/utils/request'

export function getMedicalList(url, params) {
  return request({
    url: url,
    method: 'get',
    params
  })
}

export function getMedicalSSList(params) {
  return request({
    url: 'medical/sport_science/page_list',
    method: 'get',
    params
  })
}

export function getSummaryList(params) {
  return request({
    url: 'medical/summary_list',
    method: 'get',
    params
  })
}
export function getMedicalInfo(url, params) {
  return request({
    url: url ? url : '/medical/sport_medical/query_info',
    method: 'get',
    params
  })
}

export function addMedical(url, params) {
  return request({
    url: url,
    method: 'post',
    data: params,
    transformRequest: [function (data) {
      const formData = new FormData()
      for (const key of Object.keys(data)) {
        formData.append(key, data[key])
      }
      return formData
    }]
  })
}

export function modifyMedical(url, params) {
  return request({
    url: url,
    method: 'post',
    data: params,
    transformRequest: [function (data) {
      const formData = new FormData()
      for (const key of Object.keys(data)) {
        formData.append(key, data[key])
      }
      return formData
    }]
  })
}

export function placeMedical(url, params) {
  return request({
    url: url,
    method: 'get',
    params
  })
}
